export interface Rates {
  [key: string]: number;
}

export async function getExchangeRates(): Promise<Rates> {
  try {
    const response = await fetch("https://open.er-api.com/v6/latest/USD");
    const data = await response.json();
    return data.rates as Rates;
  } catch (error) {
    throw new Error("Ошибка загрузки курсов валют");
  }
}
